package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.order.client.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
@SuppressWarnings("all")
public class PaymentController {

    @Autowired
    private OrderFeignClient orderFeignClient;


    /**
     * 支付成功页面
     * @return
     */
    @GetMapping("/pay/success.html")
    public String success(){

        return "payment/success";
    }
    /**
     * 跳转到支付选择页面
     * @return
     */
    @GetMapping("/pay.html")
    public String toPay(Long orderId, Model model){

        Result result = orderFeignClient.getOrderInfo(orderId);
        model.addAttribute("orderInfo",result.getData());

        return "payment/pay";
    }
}
